from fastapi.responses import JSONResponse
from fastapi import FastAPI, HTTPException, Request


class JWTException(HTTPException):
    def __init__(self, status_code: int, detail: str):
        super().__init__(status_code=status_code, detail=detail)


# class JWTException(HTTPException):
#     """
#     JWT 异常
#     """

#     def __init__(self, exc: HttpCode, *args, code: int | None = None, msg: str | None = None, echo_exc: bool = False, **kwargs):
#         super().__init__(status_code=exc.code, detail=msg)
#         _code = code if code is not None else exc.code
#         _message = msg if msg is not None else exc.msg
#         self._code = _code or HttpResp.FAILED.code
#         self._message = _message or HttpResp.FAILED.msg
#         self.echo_exc = echo_exc
#         self.args = args or ()
#         self.kwargs = kwargs or {}

#     @property
#     def code(self) -> int:
#         return self._code

#     @property
#     def msg(self) -> str:
#         return self._message

#     def __str__(self):
#         return '{}: {}'.format(self.code, self.msg)
